﻿/**
 * ...
 * @author sminutoli
*/

import com.dmotiko.general.*
import com.dmotiko.prune.*
import mx.utils.Delegate;

class MainBtn 
extends ButtonClip
{
	private var mcLabel:MovieClip;
	private var mcLabel2:MovieClip;
	private var mcTrigger:MovieClip;
	private var section_listener:Function;
	
	private function initClip():Void {
		super.initClip();
		mcLabel.txtLabel.autoSize = "left";
		mcLabel2.txtLabel.autoSize = "left";
		mcLabel2._visible = false;
		section_listener = Delegate.create(this, section_changed);
		Site.getApp().addEventListener( WebSite.SECTION_CHANGED, section_listener);
	}
	
	private function section_changed(e):Void {
		mcLabel._visible = e.section != SiteSections.FASHION;
		mcLabel2._visible = e.section == SiteSections.FASHION;
	}
	
	private function refreshData():Void {
		mcLabel.txtLabel.text = data.label;
		mcLabel2.txtLabel.text = data.label;
		mcTrigger._width = mcLabel._width;
	}
	
	public function onRollOver():Void {
		if ( this.bActive ) return;
		this.gotoAndPlay( OVER );
	}
	
	public function onRelease():Void {
		this.dispatchEvent( { type: BaseClipEvent.CHANGED, target: this, data: this.data, description: "setActive" } );
	}
	
}